﻿using SW.Lite.Infrastructure.Common;
using SW.Lite.Model.Master;

namespace SW.Lite.IDAL.Master
{
    public interface IButton
    {
        /// <summary>
        ///     数据是否存在
        /// </summary>
        /// <param name="id"></param>
        bool Exists(int id);

        /// <summary>
        ///     获取单个项
        /// </summary>
        /// <param name="id"></param>
        ButtonModel Single(int id);

        /// <summary>
        ///     获取所有项目
        /// </summary>
        PageList<ButtonModel> All();

        /// <summary>
        ///     根据菜单ID获取按钮列表
        /// </summary>
        /// <param name="menuId">菜单ID</param>
        /// <param name="pageIndex">页索引</param>
        /// <param name="pageSize">页大小</param>
        PageList<ButtonModel> All(int menuId, int pageIndex, int pageSize);

        /// <summary>
        ///     插入数据
        /// </summary>
        ExecuteResult Insert(ButtonModel item);

        /// <summary>
        ///     更新数据
        /// </summary>
        ExecuteResult Update(ButtonModel item);

        /// <summary>
        ///     删除数据
        /// </summary>
        /// <param name="id"></param>
        ExecuteResult Delete(int id);

        /// <summary>
        ///     根据角色ID集合获取按钮列表
        /// </summary>
        /// <param name="roleIds">角色ID集合</param>
        PageList<ButtonModel> GetButtonsByRoleIds(params int[] roleIds);

        /// <summary>
        ///     根据菜单ID获取按钮列表
        /// </summary>
        /// <param name="menuId">菜单ID</param>
        PageList<ButtonModel> GetButtonsByMenuId(int menuId);
    }
}